<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>出入库管理</title>
    <link rel="stylesheet" href="/js/elementui/index.css">

</head>
<body>
<div id="app">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="出/入库单号">
            <el-input v-model="formInline.ioNo" placeholder="请输入出/入库单号"></el-input>
        </el-form-item>
        <el-form-item label="批次">
            <el-input v-model="formInline.batch" placeholder="请输入批次号"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="onSubmit">查询</el-button>
        </el-form-item>
    </el-form>

    <el-divider><i></i></el-divider>
    <el-button type="primary" @click="dialogFormVisible1=true">出库添加</el-button>
    <el-button type="primary" @click="addInWarehouse">入库添加</el-button>
    <el-divider><i></i></el-divider>

    <el-dialog title="出库添加" :visible.sync="dialogFormVisible1" @close="closeMyDialog">
        <el-form :model="delivery">
            <el-form-item label="出库单号" :label-width="formLabelWidth">
                <el-input v-model="delivery.ioNo" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="出库类型" :label-width="formLabelWidth">
                <template>
                    <el-select v-model="delivery.ioType"
                               placeholder="请选择出库类型">
                        <el-option
                                v-for="item in deliveryType"
                                :key="item.type"
                                :label="item.type"
                                :value="item.type">
                        </el-option>
                    </el-select>
                </template>
            </el-form-item>
            <el-form-item label="批次" :label-width="formLabelWidth">
                <el-input v-model="delivery.batch" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="产品名称" :label-width="formLabelWidth">
                <el-input v-model="delivery.pName" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="产品型号" :label-width="formLabelWidth">

            </el-form-item>
            <el-form-item label="出库数量" :label-width="formLabelWidth">
                <el-input v-model="delivery.pNum" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="仓库名称" :label-width="formLabelWidth">
                <template>
                    <el-select v-model="delivery.wName"
                               placeholder="请选择仓库">
                        <el-option
                                v-for="item in selectWarehouse"
                                :key="item.id"
                                :label="item.wareName"
                                :value="item.wareName">
                        </el-option>
                    </el-select>
                </template>
            </el-form-item>
            <el-form-item label="出库时间" :label-width="formLabelWidth">
                <div class="block">
                    <span class="demonstration"></span>
                    <el-date-picker
                            v-model="delivery.ioTime"
                            type="date"
                            placeholder="选择日期"
                            format="yyyy 年 MM 月 dd 日"
                            value-format="yyyy-MM-dd">
                    </el-date-picker>
                </div>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialogFormVisible1 = false">取 消</el-button>
            <el-button type="primary" @click="saveDelivery()">保 存</el-button>

        </div>
    </el-dialog>


    <el-dialog title="入库添加" :visible.sync="dialogFormVisible2" @close="closeMyDialog">
        <el-form :model="warehousing">
            <el-form-item label="入库单号" :label-width="formLabelWidth">
                <el-input v-model="warehousing.ioNo" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="入库类型" :label-width="formLabelWidth">
                <template>
                    <el-select v-model="warehousing.ioType"
                               placeholder="请选择入库类型">
                        <el-option
                                v-for="item in warehousingType"
                                :key="item.type"
                                :label="item.type"
                                :value="item.type">
                        </el-option>
                    </el-select>
                </template>
            </el-form-item>
            <el-form-item label="批次" :label-width="formLabelWidth">
                <el-input v-model="warehousing.batch" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="入库时间" :label-width="formLabelWidth">
                <div class="block">
                    <span class="demonstration"></span>
                    <el-date-picker
                            v-model="warehousing.ioTime"
                            type="date"
                            placeholder="选择日期"
                            format="yyyy 年 MM 月 dd 日"
                            value-format="yyyy-MM-dd">
                    </el-date-picker>
                </div>
            </el-form-item>
            <el-table
                    ref="roleTable"
                    :data="tableData3"
                    style="width: 100%;">
                <el-table-column label="序号">
                    <template slot-scope="scope">
                        <span >{{scope.row.id}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="产品码">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomGoodsno}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="商品名称">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomGoods}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库库名">
                    <template>
                        <el-select v-model="addWarehouse"
                                   @change="warehouseChange"
                                   placeholder="请选择仓库">
                            <el-option
                                    v-for="item in selectWarehouse2"
                                    :key="item.id"
                                    :label="item.wareName"
                                    :value="item.id">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column label="入库区域">
                        <template>
                            <el-select v-model="addCargoArea"
                                       @change="cargoAreaChange"
                                       placeholder="请选择货区">
                                <el-option
                                        v-for="item in selectCargoArea"
                                        :key="item.id"
                                        :label="item.goodsName"
                                        :value="item.id">
                                </el-option>
                            </el-select>
                        </template>
                </el-table-column>
                <el-table-column label="入库货架">
                        <template>
                            <el-select v-model="addShelves"
                                       placeholder="请选择货架">
                                <el-option
                                        v-for="item in selectShelves"
                                        :key="item.id"
                                        :label="item.shelvesNo"
                                        :value="item.id">
                                </el-option>
                            </el-select>
                        </template>
                </el-table-column>
                <el-table-column label="入库货位">
                    <template>
                        <el-select v-model="addCargo"
                                   placeholder="请选择货位">
                            <el-option
                                    v-for="item in selectCargo"
                                    :key="item.id"
                                    :label="item.cargoNo"
                                    :value="item.id">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column label="状态">
                    <template slot-scope="scope">
                        <div style="background:#40e0d0;width: 50px;text-align: center" v-if="scope.row.state==1">{{}}</div>
                        <div style="background:#a9a9a9;width: 50px;text-align: center" v-if="scope.row.state==0">{{}}</div>
                    </template>
                </el-table-column>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button type="info" icon="el-icon-check" circle
                                   @click="roleEdit(scope.$index,scope.row)"
                                   v-if="scope.row.state==1"></el-button>
                        <el-button type="success" icon="el-icon-check" circle
                                   @click="roleEdit(scope.$index,scope.row)"
                                   v-if="scope.row.state==0"></el-button>
                    </template>
                </el-table-column>
            </el-table>

        </el-form>
        <el-button @click="dialogFormVisible2 = false">取 消</el-button>
        <el-button type="primary" @click="saveWarehousing()">保 存</el-button>
    </el-dialog>

    <el-table
            ref="roleTable"
            :data="tableData"
            style="width: 100%;">
        <el-table-column label="序号">
            <template slot-scope="scope">
                <span >{{scope.row.id}}</span>
            </template>
        </el-table-column>
        <el-table-column label="出\入库单号">
            <template slot-scope="scope">
                <span >{{scope.row.ioNo}}</span>
            </template>
        </el-table-column>
        <el-table-column label="出入库类型">
            <template slot-scope="scope">
                <span >{{scope.row.ioType}}</span>
            </template>
        </el-table-column>
        <el-table-column label="批次">
            <template slot-scope="scope">
                <span >{{scope.row.batch}}</span>
            </template>
        </el-table-column>
        <el-table-column label="产品名称">
            <template slot-scope="scope">
                <span >{{scope.row.pname}}</span>
            </template>
        </el-table-column>
        <el-table-column label="产品型号">
            <template slot-scope="scope">
                <span></span>
            </template>
        </el-table-column>
        <el-table-column label="产品数量">
            <template slot-scope="scope">
                <span >{{scope.row.pnum}}</span>
            </template>
        </el-table-column>
        <el-table-column label="仓库名称">
            <template slot-scope="scope">
                <span >{{scope.row.wname}}</span>
            </template>
        </el-table-column>
        <el-table-column label="出入库时间">
            <template slot-scope="scope">
                <span >{{scope.row.ioTime}}</span>
            </template>
        </el-table-column>
        <el-table-column label="调拨相关单号">
            <template slot-scope="scope">
                <span></span>
            </template>
        </el-table-column>

        <el-table-column label="操作">
            <template slot-scope="scope">
                <el-button type="info" icon="el-icon-check" circle
                           @click="roleEdit(scope.$index,scope.row)"></el-button>
            </template>
        </el-table-column>
    </el-table>

    <el-dialog title="查看详情" :visible.sync="dialogFormVisible3" @close="closeMyDialog">

            <div>
                入库单号：{{iomNo}}
            </div>
            <el-table
                    ref="roleTable"
                    :data="tableData2"
                    style="width: 100%;">
                <el-table-column label="序号">
                    <template slot-scope="scope">
                        <span >{{scope.row.id}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="产品码">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomGoodsno}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="商品名称">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomGoods}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库库名">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomName}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库区域">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomArea}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库货架">
                    <template slot-scope="scope">
                        <span>{{scope.row.iomShelves}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库货位">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomCargoloca}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库时间">
                    <template slot-scope="scope">
                        <span >{{scope.row.iomTime}}</span>
                    </template>
                </el-table-column>
            </el-table>
            <div style="align-content: center">
                <el-button type="primary" @click=dialogFormVisible3=false>返回</el-button>
            </div>
    </el-dialog>


    <!--分页插件-->
    <div style="float: right;">
        <el-pagination
                background
                layout="prev, pager, next"
                @current-change="loadPage"
                :total="total"
                :current-page="current"
                :page-size="pageSize">
        </el-pagination>
    </div>
    <!--入库添加-->
    <el-dialog title="添加入库单" :visible.sync="AddInWarehouseVisible" width="85%">
        <el-form label-width="150px" ref="addInWarehouseForm" :model="addInWarehouseForm">
            <el-form-item label="入库单号：" prop="inWareNum" >
                <el-input v-model="addInWarehouseForm.ioNo" ></el-input>
            </el-form-item>
            <el-form-item label="入库类型：" prop="inWareType" >
                <el-select v-model="selectProductHandoverTypeValue" clearable placeholder="请选择入库类型" @change="selectProductHandoverTypeChang(selectProductHandoverTypeValue)">
                    <el-option
                            v-for="item in selectProductHandoverType"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="批次：" prop="inWareBatch" >
                <el-input v-model="addInWarehouseForm.batch" ></el-input>
            </el-form-item>
            <el-form-item label="入库时间：" prop="inWareTime" >
                <div class="block">
                    <el-date-picker
                            v-model="addInWarehouseForm.ioTime"
                            type="datetime"
                            placeholder="选择日期"
                            format="yyyy-MM-dd "
                            value-format="yyyy-MM-dd">
                    </el-date-picker>
                </div>
            </el-form-item>
            <el-table
                    ref="addInWarehouseTable"
                    :data="addInWarehouseTable"
                    border
                    v-if="addInWarehouseTable"
                    @current-change="addInWarehouseTableCurrent"
                    style="width:100%;margin-top: 10px">
                <el-table-column label="序号" type="index">
                </el-table-column>
                <el-table-column label="产品码">
                    <template slot-scope="scope">
                        <span >{{scope.row.productNumber}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="商品名称">
                    <template slot-scope="scope">
                        <span >{{scope.row.productName}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库库名" >
                    <template slot-scope="scope">
                        <span >{{scope.row.wareName}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="入库区域" width="150px">
                    <template slot-scope="scope">
                        <el-select v-model="scope.row.selectInWarehouseCargoArea"  placeholder="请选择库区"
                                   @change="selectAddInWarehouseCargoArea(scope.row,scope.row.selectInWarehouseCargoArea)" >
                            <el-option
                                    v-for="item in addInWarehouseTable[scope.$index].cargoAreaList"
                                    :key="item.goodsNo"
                                    :label="item.goodsName"
                                    :value="item.goodsNo">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column label="入库货架"  width="150px">
                    <template slot-scope="scope">
                        <el-select v-model="scope.row.selectInWarehouseShelves" placeholder="请选择货架" @change="selectAddInWarehouseShelves(scope.row,scope.row.selectInWarehouseShelves)" >
                            <el-option
                                    v-for="item in addInWarehouseShelvesList"
                                    :key="item.shelvesNo"
                                    :label="item.shelvesNo"
                                    :value="item.shelvesNo">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column label="入库货位" width="150px">
                    <template slot-scope="scope">
                        <el-select v-model="scope.row.selectInWarehouseCargo" placeholder="请选择货位"  @change="selectAddInWarehouseCargo(scope.row.selectInWarehouseCargo)"   >
                            <el-option
                                    v-for="item in addInWarehouseCargoList"
                                    :key="item.cargoNo"
                                    :label="item.cargoNo"
                                    :value="item.cargoId">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column label="状态" width="120px" >
                    <template slot-scope="scope" >
                        <el-button type="info" disabled v-if="scope.row.isInWareStatus==0" >未确认</el-button>
                        <el-button type="success" disabled  v-if="scope.row.isInWareStatus==1" >已移库</el-button>
                    </template>
                </el-table-column>
                <el-table-column label="确认入库" width="120px" >
                    < <template slot-scope="scope">
                    <el-button type="success" icon="el-icon-check" v-if="scope.row.isInWareStatus==0" @click="confirmStorage(scope.$index,scope.row)"></el-button>
                    <el-button type="info" icon="el-icon-check" disabled  v-if="scope.row.isInWareStatus==1" ></el-button>
                </template>
                </el-table-column>
            </el-table>
            <el-form-item>
                <el-button type="primary" @click="addIomWarehouseSubmitForm('addInWarehouseForm')">保存</el-button>
                <el-button @click="addIomWarehouseResetForm('addInWarehouseForm')">取消</el-button>
            </el-form-item>
        </el-form>

    </el-dialog>
</div>
</body>
<script src="/js/vue/vue.js"></script>
<script src="/js/axios/axios.min.js"></script>
<script src="/js/qs/qs.min.js"></script>
<!-- 引入组件库 -->
<script src="/js/elementui/index.js"></script>

<script>
    new Vue({
        el:'#app',
        data(){
            return{
                formInline:{
                    ioNo:null,
                    batch:null,
                },
                selectWarehouse:{
                  id:null,
                  wareName:null
                },
                wName:null,
                selectWarehouse2:[{
                    id:'',
                    wareName:''
                }],
                addWarehouse:'',
                selectCargoArea:[{
                    id:'',
                    goodsName:''
                }],
                addCargoArea:'',
                selectShelves:[{
                    id:'',
                    shelvesNo:''
                }],
                addShelves:'',
                selectCargo:{
                  id:'',
                  cargoNo:''
                },
                addCargo:'',
                deliveryType:[{
                    type:'销售订单出库'
                },
                {
                    type:"调拨出库"
                }],
                ioType:null,
                warehousingType:[{
                    type:'采购订单入库'
                },{
                    type:'调拨入库'
                }
                ],
                current:null,
                pageSize:null,
                total:null,
                tableData:null,
                tableData2:null,
                tableData3:null,
                dialogFormVisible1:false,
                dialogFormVisible2:false,
                dialogFormVisible3:false,
                iomNo:null,
                delivery:{
                    id:null,
                    ioNo:null,
                    ioType:null,
                    batch:null,
                    pName:null,
                    pNum:null,
                    wName:null,
                    ioTime:null,
                },
                warehousing:{
                    ioNo:null,
                    ioType:null,
                    batch:null,
                    ioTime:null,

                },
                ioTime:null,
                formLabelWidth:'120px',
                labelWidth:'',
                //入库添加弹框状态
                AddInWarehouseVisible:false,
                //入库添加表单数据
                addInWarehouseForm:{
                    ioNo:'',
                    ioType:'',
                    batch:'',
                    pName:'',
                    pNum:'',
                    wName:'',
                    ioTime:''
                },
                //时间
                pickerOptions: {
                    disabledDate(time) {
                        return time.getTime() > Date.now();
                    },
                },
                //选择入库类型
                selectProductHandoverType: [{
                    value: '0',
                    label: '销售订单'
                }, {
                    value: '1',
                    label: '采购订单'
                }],
                selectProductHandoverTypeValue:'',
                //添加入库表格
                addInWarehouseTable:'',
                //当前行
                inWarehouseTableCurrent:'',
                //对应货区的货架
                addInWarehouseShelvesList:'',
                //对应货区的货位
                addInWarehouseCargoList:'',
                //货位id
                cargoId:'',
                //出入库详情
                addIomWarehouse:{
                    id:'',
                    iomGoodsno:'',
                    iomGoods:'',
                    iomName:'',
                    iomArea:'',
                    iomShelves:'',
                    iomCargoloca:'',
                    iomNo:'',
                    cargoId:''//货位id
                }
            }
        },
        mounted(){
            this.loadPage(1)
            axios.get("/wareEach")//查询仓库
                .then(value => {
                    //console.log(value.data.data)
                    this.selectWarehouse=value.data.data
                })
        },
        methods:{
            loadPage(current){
                axios.get("/ioWarehouses?current="+current)
                    .then(value => {
                        //console.log(value.data.data)
                        this.tableData=value.data.data.records
                        this.current=value.data.data.current
                        this.total=value.data.data.total
                        this.pageSize=value.data.data.pageSize
                    })
            },
            onSubmit(){//查询按钮
                //console.log(this.formInline)
                axios.get("/ioWarehouseSub?ioNo="+this.formInline.ioNo+"&batch="+this.formInline.batch)
                    .then(value => {
                        this.tableData=value.data.data
                    })
            },
            saveDelivery(){//出库保存按钮
                this.dialogFormVisible1=false;
                console.log(this.delivery)
                axios.post("/ioWarehouses",Qs.stringify(this.delivery))
                    .then(value => {
                        if(value.data.code==1){
                            this.$message({
                                type: 'success',
                                message: '添加成功!'
                            });
                        }
                        if (value.data.code==0){
                            this.$message({
                                type: 'info',
                                message: '未找到该商品，添加失败!'
                            });
                        }
                        this.loadPage(1)
                    })
            },
            saveWarehousing(){//入库保存按钮
                this.dialogFormVisible2=false;
            },
            closeMyDialog(){
                this.delivery={
                    ioNo:null,
                        ioType:null,
                        batch:null,
                        pName:null,
                        pNum:null,
                        wName:null,
                        ioTime:null,
                }

                this.warehousing={
                    ioNo:null,
                        ioType:null,
                        batch:null,
                        ioTime:null,
                }
            },
            roleEdit(index,row){//操作按钮
                this.dialogFormVisible3=true
                this.iomNo=row.ioNo
                axios.get("/iomWarehousesByIomNo?iomNo="+row.ioNo)
                    .then(value => {
                        this.tableData2=value.data.data
                    })
            },
            open(){
                this.dialogFormVisible2=true
                axios.get("/wareEach")
                    .then(value => {
                        //console.log(value.data.data)
                        this.selectWarehouse2=value.data.data
                    })
            },
            //根据仓库的字段查货区
            warehouseChange(){
                axios.get("/cargoAreas?wareId="+this.addWarehouse)
                    .then(value => {
                        //console.log(value.data.data)
                        this.selectCargoArea=value.data.data
                        this.addCargoArea=null
                        this.selectShelves=[{
                            id:null,
                            shelvesNo:null
                        }]
                        this.addShelves=null

                    })
            },
            //根据货区查货架
            cargoAreaChange(){
                axios.get("/shelves?damId="+this.addCargoArea)
                    .then(value => {
                        //console.log(value.data.data)
                        this.selectShelves=value.data.data
                        this.addShelves=null
                    })
            },
            addInWarehouse(){
                /*获得交接单的所有商品*/
                axios.get("/inWarehouse-productHandover").then(value => {
                    if (value.data.code == 1) {
                        this.$nextTick(()=>{
                            //赋值
                            this.addInWarehouseTable=value.data.data
                            console.log(this.addInWarehouseTable);
                        })
                        this.AddInWarehouseVisible=true
                    }
                });

            },
            //根据入库类型得到要入库的商品
            selectProductHandoverTypeChang(val){
                axios.get("/inWarehouse-productHandover-type/"+val).then(value => {
                    if (value.data.code == 1) {
                        this.$nextTick(()=>{
                            //赋值
                            this.addInWarehouseTable=value.data.data
                        })
                    }
                });
            },
            //当点击当前行，获得当前行的数据
            addInWarehouseTableCurrent(row){
                this.inWarehouseTableCurrent=row
            },
            //入库区域选中时的变化
            selectAddInWarehouseCargoArea(row,val){
                //清空选中的货架值
                row.selectInWarehouseShelves=null
                //清空选中的货位值
                row.selectInWarehouseCargo=null
                var shelves=row.cargoAreaList
                for (let i = 0; i < shelves.length ; i++) {
                    if (shelves[i].goodsNo==val){
                        //获得对应的货架
                        this.addInWarehouseShelvesList=shelves[i].shelvesList;
                        break
                    }else {
                        this.$message("该货区不存在货架");
                    }
                }
            },
            //货架选中时的变化
            selectAddInWarehouseShelves(row,val){
                //清空选中的货位值
                row.selectInWarehouseCargo=null
                var cargoAreaList=row.cargoAreaList
                for (let i = 0; i < cargoAreaList.length; i++) {
                    //找到当前行的货区
                    if (cargoAreaList[i].goodsNo==row.selectInWarehouseCargoArea){
                        //找到当前所选择的货架
                        var shelvesList=cargoAreaList[i].shelvesList;
                        for (let j = 0; j < shelvesList.length; j++) {
                            if (shelvesList[j].shelvesNo==row.selectInWarehouseShelves){
                                //获得对应的货位
                                this.addInWarehouseCargoList=shelvesList[j].cargoList
                                break;
                            }
                        }
                    }
                    break;
                }
            },
            //货位选中时的值
            selectAddInWarehouseCargo(val){
                //获得货位表的id
                this.cargoId=val
            },
            //确认入库
            confirmStorage(index,row) {
                if (this.addInWarehouseForm.ioNo==null||this.addInWarehouseForm.ioNo===''){
                    this.$message("未填写入库单号！")
                    return;
                }
                if (this.addInWarehouseForm.batch==null||this.addInWarehouseForm.batch===''){
                    this.$message("未填写入库单号！")
                    return;
                }
                this.addIomWarehouse.iomGoodsno=row.productNumber;
                this.addIomWarehouse.iomGoods=row.productName;
                this.addIomWarehouse.iomName=row.wareName;
                this.addIomWarehouse.iomArea=row.selectInWarehouseCargoArea;
                this.addIomWarehouse.iomShelves=row.selectInWarehouseShelves;
                this.addIomWarehouse.iomCargoloca=row.selectInWarehouseCargo;
                this.addIomWarehouse.iomNo =  this.addInWarehouseForm.ioNo
                //判断是否选择入库类型
                if (this.selectProductHandoverTypeValue==null||this.selectProductHandoverTypeValue===''){
                    this.$message("未选择入库类型！")
                    return;
                }else {
                    this.$confirm('确认要移库吗？', '信息', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        //添加入库信息
                        axios.put("/inWarehouse-iomWarehouse-inWare/",this.addIomWarehouse).then(value => {
                            if (value.data.code == 1) {
                                this.iomWarehouse = value.data.data;
                                this.$nextTick(()=>{
                                    row.isInWareStatus=1
                                })
                                //赋值
                                this.addInWarehouseForm.pName=row.productName
                                this.addInWarehouseForm.wName=row.wareName
                                this.addInWarehouseForm.pNum=row.num
                                for (let i = 0; i < this.selectProductHandoverType.length; i++) {
                                    if (this.selectProductHandoverType[i].value==this.selectProductHandoverTypeValue){
                                        this.addInWarehouseForm.ioType=this.selectProductHandoverType[i].label
                                    }
                                }
                                this.$message({
                                    type: 'success',
                                    message: '移库成功!'
                                });
                            }
                        });

                    }).catch(() => {
                        this.$message({
                            type: 'info',
                            message: '已取消移库'
                        });
                    });
                }
            },
            //新增入库信息
            addIomWarehouseSubmitForm(val){
                axios.post("/inWarehouse-inWare/",this.addInWarehouseForm).then(value => {
                    if (value.data.code == 1) {
                        this.$message({
                            type: 'success',
                            message: '保存成功!'
                        });
                        this.$refs[val].resetFields();
                        this.AddInWarehouseVisible=false
                    }
                });

            },
            addIomWarehouseResetForm(val){
                this.$refs[val].resetFields();
                this.AddInWarehouseVisible=false
            }
        }
    })
</script>
</html>